
#include "collada.h"

using namespace WtfEngine;


void ColladaParser::Load(const WtfEngine::String &sFile) {
	/// Nodes represent the graphical portion of a world object
	struct Node {
		String           sName;
		Transformation3D WorldTransform;
	};
	/// Effects are a part of materials
	struct Effect {

	};

	std::map<String, Node>   mNodes;
	std::map<String, Effect> mEffects;
	
	String sName;


	ColladaFile::Load(sFile);

	if(NextNode()) do {
		sName = GetName();
		if(sName == "library_effects") {

			//
			// Load effects
			//
			
			for(XmlIterator i = GetIterator(); i.NextSibling();) {
				if(i.GetName() == "effect") {
					for(XmlIterator eff = i.GetIterator(); eff.NextNode();) {

						sName = eff.GetName();
						
						if(sName.substr(0, 7) == "profile" || sName.substr(0, 7) == "technique") {
							// Skip
						} else if(sName == "emission") {
							
						};
					};
				} else {
					Log(LOG_WARNING, String("Unexpected element in library_effects: ") + i.GetName());
				};
			};

		} else if(sName == "library_geometries") {
			// Loading meshes
			while(NextNode() && GetName() != "/library_geometries") {
				if(sName == "geometry") {

				} else {
					throw std::runtime_error("ColladaParser: expected 'geometry'");
				};
			};
		} else if(sName == "library_visual_scenes") {

		};
	} while(NextSibling());

};